﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Awaken.Utils.WidgetCode
{
	public static class RandomBuilder
	{
		public static Random BuildRandom()
		{
			return new Random(RandomSeed());

		}
		/// <summary>
		/// 随机数
		/// </summary>
		/// <returns></returns>
		public static int RandomSeed()
		{
			byte[] bytes = new byte[4];
			System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Security.Cryptography.RNGCryptoServiceProvider();
			rng.GetBytes(bytes);
			return BitConverter.ToInt32(bytes, 0);

		}
	}
}
